<?php
declare (strict_types=1);

namespace app\exam\service;

use think\facade\Request;
use app\common\service\BaseService;
use app\exam\logic\{Paper as PaperLogic, Rollup as RollupLogic};

/**
 * 套卷服务类
 */
class Rollup extends BaseService
{

	/**
	 * 获取套卷列表
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-21
	 * @return [type] [description]
	 */
	public function getRollupList()
	{
		$param = Request::get();
		$data  = app(RollupLogic::class)->getRollupList($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 搜索套卷列表
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-21
	 * @return [type] [description]
	 */
	public function search()
	{
		$param = Request::get();
		$data  = app(RollupLogic::class)->search($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 套卷详情
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-03-31
	 * @return [type] [description]
	 */
	public function getRollupDetail()
	{
		$param = Request::get();
		$data  = app(RollupLogic::class)->getRollupDetail($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 获取指定套卷试卷的基础信息
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-04-28
	 * @return [type] [description]
	 */
	public function getRollupPaperBase()
	{
		$param = Request::get();
		$data  = app(PaperLogic::class)->getRollupPaperBase($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 获取试题信息及选项
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-21
	 * @return [type] [description]
	 */
	public function getRollupPaperTopic()
	{
		$param = Request::get();
		$data  = app(PaperLogic::class)->getPaperTopic($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 提交练习答案
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-21
	 * @return [type] [description]
	 */
	public function postRollupPaperAnswer()
	{
		$param = Request::post();
		$res = app(PaperLogic::class)->postRollupPaperAnswer($param);

		return $this->parseToData($res, 1, '提交成功');
	}
}
